import request from '@/utils/request.js';

// 文章列表
export const cateListApi = () => {
  return request({
    url: '/my/cate/list'
  });
};
// 新增分类
export const addCateApi = (data) => {
  return request({
    url: '/my/cate/add',
    method: 'post',
    data
  });
};
// 编辑文章
export const editCateApi = (data) => {
  return request({
    url: '/my/cate/info',
    method: 'put',
    data
  });
};
// 删除文章
export const delCateApi = (data) => {
  return request({
    url: `/my/cate/del`,
    method: 'delete',
    params: {
      id: data
    }
  });
};

// 文章管理
// 文章列表  query传参
export const articleListApi = (data) => {
  return request({
    url: '/my/article/list',
    method: 'get',
    params: data
  });
};
// 新增文章
export const articlePublishApi = (data) => {
  return request({
    url: '/my/article/add',
    method: 'post',
    data
  });
};

// 编辑文章获取文章详情
export const articleInfoApi = (id) => {
  return request({
    url: '/my/article/info',
    method: 'get',
    params: { id }
  });
};
// 编辑文章
export const editArticleApi = (data) => {
  return request({
    url: '/my/article/info',
    method: 'put',
    data
  });
};
// 删除文章
export const delArticleApi = (id) => {
  return request({
    url: `/my/article/info`,
    method: 'delete',
    params: {
      id
    }
  });
};
